package com.example.shirodemo.service.impl;

import com.example.shirodemo.mapper.SPermissionMapper;
import com.example.shirodemo.service.PermissionService;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 绫小路
 * @date 2021/1/14 1:19
 * @description
 */
@Service
public class PermissionServiceImpl implements PermissionService {

  @Autowired
  private SPermissionMapper sPermissionMapper;

  public static Map<String, List<String>> cachePermissionRole = new HashMap<>();

  @Override
  public List<String> getPermissionRole(String url, String method) {
    List<String> list = cachePermissionRole.get("url");//缓存
    if (list != null && !list.isEmpty()) {
      return list;
    }
    list=sPermissionMapper.getPermissionRole(url, method);
    return list;
  }
}
